using Boo.Lang;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;

[Serializable]
public class buypart : MonoBehaviour
{
	[Serializable]
	[CompilerGenerated]
	internal sealed class _0024quit_0024275 : GenericGenerator<WaitForSeconds>
	{
		internal buypart _0024self__0024277;

		public _0024quit_0024275(buypart self_)
		{
			_0024self__0024277 = self_;
		}

		public override IEnumerator<WaitForSeconds> GetEnumerator()
		{
			return new _0024(_0024self__0024277);
		}
	}

	public string currentpart;

	public Rigidbody parts;

	public AudioClip clip;

	public Color pressed;

	public Color unpressed;

	public GameObject bg;

	public int exp;

	public Collider yes;

	public Camera mainCamera;

	public buypart()
	{
		currentpart = string.Empty;
	}

	public void Update()
	{
		if (Input.GetMouseButtonUp(0))
		{
			st();
		}
		if (!Input.GetMouseButtonDown(0))
		{
			return;
		}
		RaycastHit hitInfo = default(RaycastHit);
		if (Physics.Raycast(mainCamera.ScreenPointToRay(UnityEngine.Input.mousePosition), out hitInfo, 100f) && hitInfo.collider.name == "Yes")
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			yes.GetComponent<Renderer>().material.color = pressed;
			yes.GetComponent<Renderer>().material.SetColor("_SpecColor", pressed);
			PlayerPrefs.SetInt(currentpart, 1);
			if (currentpart.Contains("Top"))
			{
				string text = currentpart.Substring(3);
				PlayerPrefs.SetInt("Attack" + text.ToString(), 1);
				PlayerPrefs.SetInt("Base" + text.ToString(), 1);
				PlayerPrefs.SetInt("Chip" + text.ToString(), 1);
				PlayerPrefs.SetInt("Disk" + text.ToString(), 1);
			}
			PlayerPrefs.SetInt("Exp", PlayerPrefs.GetInt("Exp") - exp);
			(((exp1)UnityEngine.Object.FindObjectOfType(typeof(exp1))) as exp1).check();
			parts.isKinematic = false;
			StartCoroutine(quit());
		}
	}

	public IEnumerator quit()
	{
		return new _0024quit_0024275(this).GetEnumerator();
	}

	public void st()
	{
		yes.GetComponent<Renderer>().material.color = unpressed;
		yes.GetComponent<Renderer>().material.SetColor("_SpecColor", Color.white);
	}

	public void Main()
	{
	}
}
